import 'package:mall/constant/app_strings.dart';
import 'package:mall/constant/app_urls.dart';
import 'package:mall/modules/model/home_entity.dart';
import 'package:mall/utils/net/http_util.dart';

class HomeService {
// 查询首页数据
static Future<HomeEntity> queryHomeData() async {
  var response = await HttpUtil.instance.get(AppUrls.HOME_URL);

  if (response[AppStrings.DATA] == null) {
    throw Exception(AppStrings.SERVER_EXCEPTION);
  }

  return HomeEntity.fromJson(response[AppStrings.DATA]);
}
}
